package com.yijiajiao.finance.listener;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.annotation.WebListener;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author tbc tianbencai@e-eduspace.com
 * @version 1.0 {2016年5月4日 上午9:07:43}
 */
@Slf4j
@WebListener
public class LocalThreadPool {
    public static String LOCAL_THREAD_POOL = "localThreadPool";
    private static ExecutorService threadPool;

    static {
        int CPUs = Runtime.getRuntime().availableProcessors();
        threadPool = Executors.newFixedThreadPool(CPUs * 2);
    }

    public static ExecutorService getLocalThreadPool() {
        return threadPool;
    }


}
